"""
网络请求：检查版本
"""
import requests
from src.config import settings


def app_version():
    """检查版本"""
    try:
        response = requests.get(settings.app_version_url)
    except Exception:
        return 1001, '网络请求出错'
    if response.status_code != 200:
        return 1002, f'请求失败，状态码：{response.status_code}'
    res = response.json()
    if res['code'] != 2000:
        return 1003, res['message']
    return 1000, res['data']
